<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:pe="http://primefaces.org/ui/extensions">

    <ui:composition>

        <p:dialog id="dlgDespesa"
                  header="Despesa"
                  widgetVar="dialogDespesa" 
                  modal="true" 
                  resizable="false" 
                  appendTo="@(body)" 
                  dynamic="true" >

            <h:form id="formDespesa" >

                <h:panelGrid id="displayDespesa" >

                    <h:panelGroup>

                        <h:outputText value="Descrição" /><br/>
                        <p:inputText value="#{despesaBean.selected.descricao}" 
                                     style="width: 250px; text-transform: uppercase"
                                     required="true"
                                     requiredMessage="Campo descrição requerido"
                                     /><br/>

                    </h:panelGroup>

                    <h:panelGroup>

                        <h:outputText value="Valor" /><br/>
                        <pe:inputNumber value="#{despesaBean.selected.valor}" 
                                        style="width: 250px"
                                        required="true"
                                        requiredMessage="Campo valor requerido" 
                                        decimalSeparator=","
                                        thousandSeparator="."
                                        symbol="R$" /><br/>

                    </h:panelGroup>

                    <h:panelGroup>

                        <h:outputText value="Data" /><br/>
                        <p:inputMask value="#{despesaBean.selected.dataDespesa}" 
                                     style="width: 250px" 
                                     mask="99/99/9999" 
                                     required="true"
                                     requiredMessage="Campo data requerido" >

                            <f:convertDateTime timeZone="America/Sao_Paulo"/>

                        </p:inputMask><br/>

                    </h:panelGroup>

                </h:panelGrid>


                <hr/>

                <p:commandButton value="Gravar" 
                                 actionListener="#{despesaBean.save(event)}"
                                 update=":formDespesas:dtDespesas, :growl, displayDespesa"
                                 oncomplete="handleSubmit(xhr,status,args,dialogDespesa);"
                                 />


            </h:form>

        </p:dialog>

    </ui:composition>

</html>


